package com.music.biz.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.music.biz.GenreBiz;
import com.music.dao.GenreDao;
import com.music.entity.Genre;

@Service("genreBiz")
public class GenreBizImpl implements GenreBiz {

	@Autowired
	private GenreDao dao;
	
	public List<Genre> getAll() {
		return dao.getAll();
	}

	@Transactional(propagation=Propagation.REQUIRED)
	public void add(Genre genre) {
		dao.add(genre);
		
	}

	@Transactional(propagation=Propagation.REQUIRED)
	public void update(Genre genre) {
		dao.update(genre);
		
	}

	@Transactional(propagation=Propagation.REQUIRED)
	public void delete(int genre) {
		dao.delete(genre);
		
	}

	public Genre fetchById(int id) {
		// TODO Auto-generated method stub
		return dao.fetchById(id);
	}

	@Override
	public List<Genre> getGenresByName(String name) {
		// TODO Auto-generated method stub
		return dao.getGenresByName(name);
	}

	
}
